package com.fwzc.giuseppe.activity;

import java.util.ArrayList;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import com.fwzc.giuseppe.R;
import com.fwzc.giuseppe.adapter.GrideAdapter;
import com.fwzc.giuseppe.base.BaseActivity;
import com.fwzc.giuseppe.view.MyGridView;

/**
 * 收藏夹
 * 
 * @author llf
 * 
 */
public class FavoriteActivity extends BaseActivity implements OnClickListener {
	private MyGridView favorite;
	private GrideAdapter adapter;
	private ArrayList<String> datas = new ArrayList<String>();
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_favorite);

		initBar();
		initView();
		initClick();
	}

	private void initView() {
		actionbar_side_name.setText("收藏夹");
		iv_actionbar_side_left.setVisibility(View.VISIBLE);
		bg_actionbar_side.setBackgroundColor(getResources().getColor(R.color.transparent));
		iv_actionbar_side_left.setOnClickListener(this);
		
		favorite = (MyGridView)findViewById(R.id.favorite);
		for (int i = 0; i < 6; i++) {
			datas.add(i + "");
		}
		adapter = new GrideAdapter(this, datas);
		favorite.setAdapter(adapter);
	}

	private void initClick(){
		favorite.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				showToast(position+"个");
			}
		});
	}
	
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.iv_actionbar_side_left:
			finish();
			break;

		default:
			break;
		}
	}
}
